<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>我的教程---知道吗</title>
</head>
<body>
<jsp:include page="/topNav"></jsp:include>
<form name="contentForm" method="get" action="viewTheContents">
    <input type="hidden" name="id" id="id" value="" />
</form>
<form name="editForm" method="get" action="editTutorial">
    <input type="hidden" name="tid" id="tid" value="" />
</form>
<div class="container">

    <div class="row">
        <div class="col-xs-7" style="margin-top: -20px">
            <h4 class="page-header">我的教程</h4>
            <c:if test="${tutorialData.myTutorials != null}">
                <c:forEach var="tutorial" items="${tutorialData.myTutorials}">
                    <div class="media" id="${tutorial.id}_all">
                        <img class="media-object pull-left" src="${tutorial.titleImgPath}" width="128" length="128"
                             style="margin-top: 15px">

                        <div class="media-body">
                            <p style="color: #999999;margin-bottom: 3px;margin-left: 5px;">${tutorial.userName}&nbsp;&nbsp;
                                &nbsp;<fmt:formatDate
                                        value="${tutorial.createTime}"
                                        type="both"
                                        pattern="YYYY-MM-dd HH:mm:ss" />&nbsp;
                                &nbsp;&nbsp;
                                    ${tutorial.scorecount}人评分&nbsp;
                                平均<font color="green" size="5">
                                    <c:if test="${tutorial.scorecount != 0}">
                                        <fmt:formatNumber value="${tutorial.totalscore/tutorial.scorecount}" pattern="0.0" />
                                    </c:if>
                                    <c:if test="${tutorial.scorecount == 0}">
                                        <fmt:formatNumber value="0.0" pattern="0.0" />
                                    </c:if></font>分&nbsp;&nbsp;
                                    <c:if test="${!tutorial.audited}">
                                        <font color="red">审核中</font>
                                    </c:if>
                            </p>
                            <h4 class="media-heading"><a href="javascript:show(${tutorial.id})">${tutorial.title}</a></h4>

                            <div class="caption" style="margin-left: 5px">
                                <p>${tutorial.introduce}</p>

                                <p style="color: #999999">
                                    <span class="glyphicon glyphicon-eye-open"></span>&nbsp;${tutorial.views}次浏览&nbsp;&nbsp;
                                    <span class="glyphicon glyphicon-comment"></span>&nbsp;0条评论&nbsp;&nbsp;
                                    <span class="glyphicon glyphicon-star"></span>&nbsp;${tutorial.stores}人收藏&nbsp;&nbsp;
                                    <span class="glyphicon glyphicon-edit"></span>&nbsp;
                                    <a href="javascript:edit(${tutorial.id})" style="color:
                                            #999999">编辑</a>&nbsp;&nbsp;
                                    <span class="glyphicon glyphicon-remove"></span>&nbsp;
                                    <a href="javascript:deleteTutorial(${tutorial.id})" style="color:
                                            #999999">删除</a>&nbsp;&nbsp;
                                </p>
                            </div>
                        </div>
                    </div>
                </c:forEach>
                <c:if test="${tutorialData.mytutorialss_requires_pagination}">
                    <button type="button" id="loading-more" data-loading-text="加载中..." class="btn btn-block"
                            style="margin-bottom: 20px">更多
                    </button>
                </c:if>
            </c:if>
            <c:if test="${tutorialData.myTutorials == null}">
                <div class="text-center">暂无内容</div>
            </c:if>

        </div>


        <div class="col-xs-4">
            <h2 class="page-header"></h2>

            <ul class="nav nav-list">
                <li>
                    <a href="/Origami/myTutorials" style="color: #646464">
                        <span class="glyphicon glyphicon-file"></span>&nbsp;&nbsp;&nbsp;&nbsp;我的教程
                    </a>
                </li>
                <li>
                    <a href="/Origami/myCollection" style="color: #646464">
                        <span class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;&nbsp;&nbsp;我的收藏
                    </a>
                </li>
                <li>
                    <a href="#" style="color: #646464">
                        <span class="glyphicon glyphicon-comment"></span>&nbsp;&nbsp;&nbsp;&nbsp;我评论的
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>
</body>
<link href="bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="bootstrap/user_defined.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="uploadify/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="js/myTutorial.js"></script>
<script language="javascript">
    function show(id) {
        document.getElementById("id").setAttribute("value", id);
        contentForm.submit();
    }
    function edit(id) {
        document.getElementById("tid").setAttribute("value", id);
        editForm.submit();
    }

</script>
</html>
